<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>

<link rel="stylesheet" href="${pageContext.request.contextPath}/jquery-ui/jquery-ui.min.css">
<link rel="stylesheet" href="${pageContext.request.contextPath}/themes/icon.css" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/main.css" />
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/jquery-ui/jquery-ui.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/common.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.validate.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/api.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/memberMain.js"></script>

<script type="text/javascript">
$(function() {
	 var urlPrefix = "${pageContext.request.contextPath}/api/";
	 var memberAPI = new MemberAPI({
			urlPrefix : urlPrefix
		});
	
	 var tenderEnrollAPI = new TenderEnrollAPI({
			urlPrefix : urlPrefix
		});
	 var tenderQuoteSearchAPI = new TenderQuoteSearchAPI({
		 urlPrefix : urlPrefix
	 });
	 var memberLoginName= '${memberLoginName}';

	 //个人信息
		getPersonalData({
		    onSuccess: function(data) {
		    	$("#memberLoginName").html(data.member_login_name);
		    	$("#enterpriseName").html(data.enterprise_name);
		    	$("#enterprisePropertyName").html(data.enterprise_property_name);
		    	$("#enterpriseCategoryName").html(data.enterprise_category_name);
		    	$("#contactName").html(data.contact_name);
		    	$("#telephone").html(data.telephone);
		    	$("#mobile").html(data.mobile);
		         }
		});
		function getPersonalData(callback) {
			var paramData = {};
			paramData.member_login_name = memberLoginName;
			memberAPI.info({
				onSuccess : function(data) {
				    if (callback) {
				        if (data != null) {
				            if (callback.onSuccess && typeof(callback.onSuccess) == "function") {
				                callback.onSuccess(data);
				            }
						} else {
						    if (callback.onError && typeof(callback.onError) == "function") {
				                callback.onError();
				            }
						}
				    }
				},
				onAPIError : function(status, errors) {
				},
				onServerError : function(jqXHR, textStatus, errorThrown) {
				}
			}, {
				param : JSON.stringify(paramData),
				page : 1,
				rows : 25
			});
		}
		//报名记录
		getRegistrationRcord({
		    onSuccess: function(data) {
		        $('#enroll_list').children('li').remove();
		        $.each(data.tenderEnrolls, function(index, row) {
		        	if(index < 4)
		        		{
		        		var strHtml = '<li class="dataLi"><div class="tendertitle"><a href="#">' + row.tender_title+ '</a></div>'+
						  '&nbsp;<div class="enrolldate"><a href="#" >' + row.enroll_date + '</a></div>'+
						  '&nbsp;<div class="statusname"><a href="#" >' + row.status_name + '</a></div>'+
						  '&nbsp;<div class="findsee"><a href="#" onclick="memberLoadPage(\'registration_search.action\','+ row.tender_id + ');">查看</a></div></li>';
			              $('#enroll_list').append(strHtml);			        		  
		        		}
		        });
		    }
		});
 		function getRegistrationRcord(callback) {
 			
 			//报名记录信息查询开始
			var paramData = {};
			paramData.member_login_name  = memberLoginName;
			tenderEnrollAPI.search({
				onSuccess : function(data) {
				    if (callback) {
				        if (data.total > 0) {
				            if (callback.onSuccess && typeof(callback.onSuccess) == "function") {
				            	callback.onSuccess(data);
				            }
						} else {
						    if (callback.onError && typeof(callback.onError) == "function") {
				                callback.onError();
				            }
						}
				    }
				},
				onAPIError : function(status, errors) {
				},
				onServerError : function(jqXHR, textStatus, errorThrown) {
				}
			}, {
				param : JSON.stringify(paramData),
				page : 1,
				rows : 25
			});
		}  
		//投标记录
		getBidRcord({
		    onSuccess: function(data) {
		        $('#bid_list').children('li').remove();
		        $.each(data.tenderQuotes, function(index, row) {
		        	if(index < 4)
		        		{		        			
		        		var strHtml = '<li class="dataLi"><div class="tendertitle"><a href="#">' + row.tender_title+ '</a></div>'+
						  '&nbsp;<div class="enrolldate"><a href="#" >' + row.quote_date + '</a></div>'+
						  '&nbsp;<div class="statusname"><a href="#" >' + row.status_name + '</a></div>'+
						  '&nbsp;<div class="findsee"><a href="#" onclick="memberLoadPage(\'registration_search.action\','+ row.tender_id + ');">查看</a></div></li>';
			              $('#bid_list').append(strHtml);	
		        		}
		        });
		       
		    }
		});
 		function getBidRcord(callback) {
 			//投标记录信息查询开始
			var paramData = {};
			paramData.member_login_name  = memberLoginName;
			tenderQuoteSearchAPI.search({
				onSuccess : function(data) {
				    if (callback) {
				        if (data.total > 0) {
				            if (callback.onSuccess && typeof(callback.onSuccess) == "function") {
				            	callback.onSuccess(data);
				            }
						} else {
						    if (callback.onError && typeof(callback.onError) == "function") {
				                callback.onError();
				            }
						}
				    }
				},
				onAPIError : function(status, errors) {
				},
				onServerError : function(jqXHR, textStatus, errorThrown) {
				}
			}, {
				param : JSON.stringify(paramData),
				page : 1,
				rows : 25
			});
		}  
 		
 		$('#searchmemberinfo').unbind('click');
		$('#searchmemberinfo').bind('click', function() {	
			memberLoadContent('member_pesonal.action');
		});
		
		$('#searchenroll').unbind('click');
		$('#searchenroll').bind('click', function() {	
			memberLoadContent('registration_rcord.action');
		});
		
		$('#searchfinalist').unbind('click');
		$('#searchfinalist').bind('click', function() {	
			memberLoadContent('quote_rcord.action');
		});

});
</script>

    <div style="margin: 0 auto; margin-top: 10px; margin-left: 10px; ">        
        <!-- 个人中心开始 -->
        <div class="panel" style="width:450px;height: 165px; border-radius:10px; border:1px solid #d4d4d4;" >
	        <div style="margin-top: 5px;padding-bottom: 5px;padding-left:15px; border-bottom:1px solid #d4d4d4;">
	         <span  style="font-size:15px;">个人资料</span>
	         <a id="searchmemberinfo" href="#" style="float:right; margin-right:15px;">查看全部>></a>
	        </div>
	        <div>
			  <table id="personData" class="personData">
			    <tr>
			      <th>用户名:</th>
			      <td colspan="3"><label id="memberLoginName" class="titlelabellong"></label> </td>
			    </tr>
			    <tr>
			      <th>企业名称:</th>
		          <td colspan="3"><label id="enterpriseName" class="titlelabellong"></label></td>
			    </tr>       
		        <tr>
		          <th>企业性质:</th>
		          <td><label id="enterprisePropertyName" class="titlelabel"></label></td>
		        		        
		          <th>行业分类:</th>
		          <td><label id="enterpriseCategoryName" class="titlelabel"></label></td>
		        </tr>        
		        <tr>
		          <th>联系人:</th>
		          <td colspan="3"><label id="contactName" class="titlelabellong"></label></td>
		        </tr>
		        <tr>
		          <th>联系电话:</th>
		          <td><label id="telephone" class="titlelabel"></label></td>
		          
		          <td colspan="2"><label id="mobile" class="titlelabel"></label></td>
		        </tr>         
	         </table>
	         </div>
	      </div>
	      <!-- 个人中心结束 --> 
	   
	    <div>
	    <!-- 统计开始 -->
		<!-- 统计结束 -->
	    </div>

        <!-- 报名记录开始 -->
      <div class="panel" style="width:450px;height: 165px; border-radius:10px;margin-top: 15px; border:1px solid #d4d4d4;" >
	        <div style="margin-top: 5px;padding-bottom: 5px;padding-left:15px; border-bottom:1px solid #d4d4d4;">
	         <span  style="font-size:15px;">报名记录</span>
	         <a id="searchenroll" href="#" style="float:right; margin-right:15px;">查看全部>></a>
	        </div>
	        <div> 
	         <ul id="enroll_list" ></ul>
	        </div>
      </div>
        <!-- 报名记录结束 -->
        
        <div>
        <!-- 我的关注开始 -->
        <!-- 我的关注结束 -->
        </div>
     
        <!-- 投标记录开始 -->
	     <div class="panel" style="width:450px;height: 165px; border-radius:10px;margin-top: 15px; border:1px solid #d4d4d4;" >
	        <div style="margin-top: 5px;padding-bottom: 5px;padding-left:15px; border-bottom:1px solid #d4d4d4;">
	         <span  style="font-size:15px;">投标记录</span>
	         <a id="searchfinalist" href="#" style="float:right; margin-right:15px;">查看全部>></a>
	        </div>
	        <div>
             <ul id="bid_list" ></ul>
            </div>
	    </div>
        <!-- 投标记录结束 -->
        
        <div>
        <!-- 我的消息开始 -->
        <!-- 我的消息结束 -->
        </div>
     
    </div>
  

